﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CoreRp
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
    public class Is_Menu: Attribute
    {
        public string MenuCode { get; set; }
        public string MenuName { get; set; }
        public int OrderId { get; set; }
        public List<string> RoleCodes { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="MenuName">菜单名称</param>
        /// <param name="OrderId">排序序号，默认可以写0</param>
        public Is_Menu(string MenuName, int OrderId,params E_Roles[] Roles)
        {
            this.MenuCode = this.GetType().FullName;
            this.MenuName = MenuName;
            this.OrderId = OrderId;
            this.RoleCodes = Roles.Select(x=>x.ToString()).ToList();
        }
    }
}
